package com.wans.product.interceptor;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

@Component
public class FirstHandleInterceptor implements HandlerInterceptor {
    /**
     * 请求处理之前执行
     * @param request 请求
     * @param response 响应
     * @param handler 处理器
     * @return 是否继续执行
     */
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {

        String token = request.getHeader("token");
        System.out.println("远程调用的token -> "+token);

        return true;
    }

}
